﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TSharp.Core.Repository.Migration
{
    /// <summary>
    /// 数据迁移服务
    /// </summary>
    public interface IMigrationService
    {
        /// <summary>
        /// 是否允许自动迁移
        /// </summary>
        bool IsAutomaticMigrationAllowed { get; set; }
        /// <summary>
        /// WebConfig中连接字符串的Name
        /// </summary>
        /// <value>The name of the connection.</value>
        string ConnectionName { get; set; }
        /// <summary>
        /// Updates the target database to a given migration.
        /// 
        /// </summary>
        /// <param name="targetMigration">The migration to upgrade/downgrade to.</param>
        void Update(string targetMigration);
        /// <summary>
        /// Updates the target database to the latest migration.
        /// 
        /// </summary>
        void Update();
        /// <summary>
        /// Gets all migrations that are defined in the assembly but haven't been applied to the target database.
        /// 
        /// </summary>
        IEnumerable<string> GetPendingMigrations();
        /// <summary>
        /// Gets all migrations that are defined in the configured migrations assembly.
        /// 
        /// </summary>
        IEnumerable<string> GetLocalMigrations();
        /// <summary>
        /// Gets a list of the migrations that have been applied to the database.
        /// 
        /// </summary>
        /// 
        /// <returns>
        /// List of migration Ids
        /// </returns>
        IEnumerable<string> GetDatabaseMigrations();
    }
}
